package com.spider.controller;

import com.spider.domain.ResponseResult;
import com.spider.service.UploadService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 罗振军
 * @version V1.0
 * @Package com.spider.controller
 * @date 2024/7/23 16:14
 */
@RestController
@Api(tags = "文件上传的相关接口文档", description = "我是描述信息")
public class UploadController {

    @Autowired
    //UploadService是我们在spider-framework写的接口
    private UploadService uploadService;

    @PostMapping("/upload")
    //MultipartFile是spring提供的接口，ResponseResult是我们在spider-framework写的实体类
    public ResponseResult uploadImg(MultipartFile img){
        //图片上传到七牛云
        return uploadService.uploadImg(img);
    }
}